package net.gd.domain;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import net.gd.utils.Constants;
import net.sf.json.JSONObject;

public class UdfModelInfo {

  private String modelId;
  private String modelName;
  private String langType;
  private String modelContent;
  private String modelStatus;
  private String createUser;
  private Date createDatetime;
  private Date updateDatetime;
  private String topicId;

  public JSONObject toJson() {
    SimpleDateFormat df = new SimpleDateFormat(Constants.DATETIME_FORMAT);
    Map<String, String> map = new HashMap<>();
    map.put("model_id", this.modelId);
    map.put("model_name", this.modelName);
    map.put("lang_type", this.langType);
    map.put("model_content", this.modelContent);
    map.put("model_status", this.modelStatus);
    map.put("create_user", this.createUser);
    map.put("create_datetime", this.createDatetime != null ? df.format(this.createDatetime) : null);
    map.put("update_datetime", this.updateDatetime != null ? df.format(this.updateDatetime) : null);
    map.put("topic_id", this.topicId);
    return JSONObject.fromObject(map);
  }


  public String getModelId() {
    return modelId;
  }

  public void setModelId(String modelId) {
    this.modelId = modelId;
  }

  public String getModelName() {
    return modelName;
  }

  public void setModelName(String modelName) {
    this.modelName = modelName;
  }

  public String getLangType() {
    return langType;
  }

  public void setLangType(String langType) {
    this.langType = langType;
  }

  public String getModelContent() {
    return modelContent;
  }

  public void setModelContent(String modelContent) {
    this.modelContent = modelContent;
  }

  public String getModelStatus() {
    return modelStatus;
  }

  public void setModelStatus(String modelStatus) {
    this.modelStatus = modelStatus;
  }

  public String getCreateUser() {
    return createUser;
  }

  public void setCreateUser(String createUser) {
    this.createUser = createUser;
  }

  public Date getCreateDatetime() {
    return createDatetime;
  }

  public void setCreateDatetime(Date createDatetime) {
    this.createDatetime = createDatetime;
  }

  public Date getUpdateDatetime() {
    return updateDatetime;
  }

  public void setUpdateDatetime(Date updateDatetime) {
    this.updateDatetime = updateDatetime;
  }

  public String getTopicId() {
    return topicId;
  }

  public void setTopicId(String topicId) {
    this.topicId = topicId;
  }

  @Override
  public String toString() {
    return "UdfModelInfo [modelId=" + modelId + ", modelName=" + modelName + ", langType="
        + langType + ", modelContent=" + modelContent + ", modelStatus=" + modelStatus
        + ", createUser=" + createUser + ", createDatetime=" + createDatetime + ", updateDatetime="
        + updateDatetime + ", topicId=" + topicId + "]";
  }



}
